    $(function () {
        var wayfinder = window._wayfinder;
        var ScopeNodeType = Microsoft.Support.GSS.ScopeNodeType;
        var gpsSelector = "#gps";
        var $gps = $(gpsSelector);
        if ($gps.length == 0) return;

        var gps = new Microsoft.Support.GSS.GPS(gpsSelector, {
            language: 'en-us',
            loadingHtml: $("script.gps.loading-panel[type='text/html']").remove().html(),
            errorHtml: $("script.gps.error-panel[type='text/html']").remove().html(),
            modality: 'SelfHelp',
            modalitySettings: {
                "selfhelp": {
                    allowCache: function (modality, scope, query) {
                        // cache findsolutions, but not in search mode.
                        return query["query"] === undefined;
                    },
                    getContentKey: function (modality, scope, query) {
                        if (query["query"] !== undefined) {
                            return modality + (scope ? "_" + scope.getPath() : "") + "_search[" + query["query"] + "]";
                        } else if (scope) {
                            var type = scope.get("type");
                            var product = scope.findParentByType(ScopeNodeType.Product, true);
                            if (product && product.findChildrenByType(ScopeNodeType.Product).length === 0) {   // product is full selected
                                if (product.get("props").seamId) {
                                    // has seamid, load topic->solutions(findsolutions workflow)
                                    if (type === ScopeNodeType.Topic && scope.get("props").leaf) {  // topic is full selected
                                        return modality + "_SOLUTIONS";
                                    } else {
                                        return modality + "_" + product.getPath();
                                    }
                                } else {
                                    // no seam id
                                    return modality + '_' + product.getPath();
                                }
                            }
                        }
                        return modality;
                    }
                },
                "community": {
                    allowCache: true,
                    getContentKey: function (modality, scope, query) {
                        var path = scope ? scope.getPath() : '';
                        return modality + (path ? "_" + path : '');

                        // NOTICE: if you need show topic control before landing to community go-link page, please remove above code.
                        if (scope) {
                            var type = scope.get("type");
                            var product = scope.findParentByType(ScopeNodeType.Product, true);
                            if (product && product.findChildrenByType(ScopeNodeType.Product).length === 0) {   // product is full selected
                                if (product.get("props").seamId) {
                                    // has seamid, load topic to narrow scope
                                    if (type === ScopeNodeType.Topic && scope.get("props").leaf) {  // topic is full selected
                                        return modality + "_" + scope.getPath();
                                    } else {
                                        return modality + "_" + product.getPath();
                                    }
                                } else {
                                    // no seam id
                                    return modality + '_' + product.getPath();
                                }
                            }
                        }
                        return modality;
                    }
                },
                "support": {
                    allowCache: false,      // there's an issue when using cache for getsupport page, so stop to use it.
                    forceLoad: function (modality, scope, query) {
                        if (scope) {
                            var type = scope.get("type");
                            if (type === ScopeNodeType.Product) {
                                return true;
                            }
                        }
                        return false;
                    },
                    getContentKey: function (modality, scope, query) {
                        if (scope) {
                            var type = scope.get("type");
                            var product = scope.findParentByType(ScopeNodeType.Product, true);
                            if (product && product.findChildrenByType(ScopeNodeType.Product).length === 0) {   // product is full selected
                                if (product.get("props").seamId) {
                                    // has seamid
                                    // CAUSION: we don't know whether we should load topic here, it's up to server-side.
                                    // if we found current scope is topic, we should determine it is full selected topic path.
                                    // if not, we should keep unique key to prevent content switching during selecting topic levels.
                                    if (type === ScopeNodeType.Topic && scope.get("props").leaf) {  // topic is full selected
                                        return modality + "_" + scope.getPath();
                                    } else {
                                        return modality + "_" + product.getPath();
                                    }
                                } else {
                                    // no seam id
                                    return modality + '_' + product.getPath();
                                }
                            }
                        }
                        return modality;
                    }
                }
            },
            scope: wayfinder ? wayfinder.getCurrentScope() : null,
            query: 'ln=en-us',
            isRTL: false
            });

        $gps[0]._instance = gps;
        window._gps = gps;

        // notice findsolutions to switch current product when wayfinder changed product
        if (wayfinder) {
            $(wayfinder).bind("modalityselect", function (evt, modality, srcEvt) {
                srcEvt.preventDefault();
                gps.changeModality(modality.type, wayfinder.getCurrentScope());
            }).bind("productselect", function (e, product, srcEvt) {
                srcEvt.preventDefault();
            }).bind("scopechange", function(e, scope) {
                gps.changeScope(scope);
            });
        }
    });